<?php

// Includes obligatorios
include ('./dbconfig.php');
include ('../Libraries/Tools/JLTools.class.php');

// Objeto JLTools
$jl = new JLTools();

if (isset($_GET['_id']))
    $where = " WHERE tbl_actualites.int_id_user = '" . $_GET['_id'] . "' && tbl_actualites.int_id_section <> '0'";
else
    $where = " WHERE tbl_actualites.int_id_section <> '27'";

$SQL = "SELECT 
	  tbl_actualites.int_actualite,
	  tbl_actualites.var_monthyear,
	  tbl_actualites.dat_creation_act,
	  tbl_actualites.var_ac_title,
	  tbl_sections.var_desc_section,
          tbl_actualites.int_vote,
	  tbl_states.var_htmldesc
	FROM
	  tbl_sections
	  INNER JOIN tbl_actualites ON (tbl_sections.int_id_section = tbl_actualites.int_id_section)
	  INNER JOIN tbl_states ON (tbl_actualites.int_id_state = tbl_states.int_id_state)" . $where;
$campoId = "int_actualite";

$jl->dataGridJSON($cnn, $SQL, $campoId, true);

// Cerrar la coneccion obligatorio
mysql_close($cnn);